<template>
  <div class="personnel">


    <el-tabs v-model="activeName" stretch style="overflow-y: auto" @tab-click="handleClick">
      <el-tab-pane name="detail" label="出勤明细数据">
        <div class="tool">
          <el-form :inline="true">
            <el-form-item label="日期">
              <el-date-picker v-model="form.archivesDate" value-format="yyyy-MM-dd" size="small"
                              :clearable="false"></el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button @click="getDetailDataList" size="small">查询</el-button>
            </el-form-item>
            <p style="float: right">数据来源：{{ title }}<span></span></p>
          </el-form>
        </div>
        <div class="detail data">
          <el-table :data="detailData" show-summary border stripe sum-text="合计"
                    :span-method="objectSpanMethod"
                    :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
            <el-table-column label="部门" prop="deptLevel2" min-width="140px">
              <template slot-scope="scope">
                {{ scope.row.deptLevel2 }}
              </template>
            </el-table-column>
            <el-table-column label="班别" prop="shift"></el-table-column>
            <el-table-column label="人力性质" prop="natureManpower" width="100px"></el-table-column>
            <el-table-column label="应到人数" prop="shouldArrive"></el-table-column>
            <el-table-column label="实到人数" prop="actualArrive"></el-table-column>
            <el-table-column label="免打卡人数" prop="freeSign" width="100px"></el-table-column>
            <el-table-column label="未出勤人数" prop="unAttendance" width="120px">
            </el-table-column>
            <el-table-column label="未出勤率">
              <template slot-scope="scope">
                {{ getNumber(scope.row.unAttendance, scope.row.shouldArrive) }}
              </template>
            </el-table-column>
            <el-table-column label="出差" prop="businessTrips">
              <template slot-scope="scope">
                <span v-show="scope.row.businessTrips>0" v-text="scope.row.businessTrips"></span>
              </template>
            </el-table-column>
            <el-table-column label="未出勤明细">
              <el-table-column label="年假" prop="yearLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.yearLeave>0" v-text="scope.row.yearLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="工伤假" prop="workInjuryLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.workInjuryLeave>0" v-text="scope.row.workInjuryLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="病假" prop="sickLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.sickLeave>0" v-text="scope.row.sickLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="产假" prop="maternityLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.maternityLeave>0" v-text="scope.row.maternityLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="事假" prop="personalLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.personalLeave>0" v-text="scope.row.personalLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="婚假" prop="marriageLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.marriageLeave>0" v-text="scope.row.marriageLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="丧假" prop="funeralLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.funeralLeave>0" v-text="scope.row.funeralLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="调休" prop="compensatoryLeave">
                <template slot-scope="scope">
                  <span v-show="scope.row.compensatoryLeave>0" v-text="scope.row.compensatoryLeave"></span>
                </template>
              </el-table-column>
              <el-table-column label="打卡异常" prop="absenteeism">
                <template slot-scope="scope">
                  <span v-show="scope.row.absenteeism>0" v-text="scope.row.absenteeism"></span>
                </template>
              </el-table-column>

            </el-table-column>
          </el-table>
        </div>
      </el-tab-pane>
      <el-tab-pane name="summary" label="直接间接汇总">
        <el-row :gutter="20">
          <el-col :span="6">
            <div class="tool">
              <el-form :inline="true">
                <el-form-item label="日期">
                  <el-date-picker v-model="form.archivesDate" size="small"
                                  :clearable="false"></el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button @click="getSummaryDataList" size="small">查询</el-button>
                </el-form-item>
              </el-form>
            </div>
            <div class="summary">
              <h3 align="center">瀚海直接/间接人力占比汇总表</h3>
              <el-table :data="summaryData" border stripe sum-text="合计" :span-method="objectSpanMethod1"
                        :header-cell-style="{'text-align':'center'}" :cell-style="{'text-align':'center'}">
                <el-table-column label="部门" prop="deptLevel1" min-width="100">
                  <template slot-scope="scope">
                    {{ scope.row.deptLevel2 }}
                  </template>
                </el-table-column>
                <el-table-column label="人力性质" prop="natureManpower" width="100"></el-table-column>
                <el-table-column label="人力数量" prop="peopleNum" width="100"></el-table-column>
                <el-table-column label="人力占比" prop="totalPeopleNum" width="100">
                  <template slot-scope="scope">
                    {{ getNumber(scope.row.peopleNum, scope.row.totalPeopleNum) }}
                  </template>
                </el-table-column>

              </el-table>
            </div>
          </el-col>
          <el-col :span="18">
            <div class="tool">
              <el-form :inline="true">
                <el-form-item label="日期">
                  <el-date-picker size="small"
                                  value-format="yyyy-MM-01"
                                  v-model="recruitForm.yearMonthDate"
                                  type="month"
                                  placeholder="选择月"
                                  :clearable="false">
                  </el-date-picker>
                </el-form-item>
                <el-form-item>
                  <el-button @click="getRecruitData" size="small">查询</el-button>
                </el-form-item>
              </el-form>
            </div>
            <h3 align="center">{{ recruitForm.yearMonthDate|formatDateMonth }}招聘情况明细表</h3>

            <el-table :data="recruitData1" border stripe sum-text="合计" show-summary
                      :header-cell-style="{'text-align':'center'}"
                      :cell-style="{'text-align':'center'}">
              <el-table-column label="部门" prop="deptLevel1" min-width="120" fixed>
              </el-table-column>
              <el-table-column label="人力性质" prop="natureManPower" fixed width="120"></el-table-column>
              <el-table-column label="入职合计" prop="totalCount" fixed width="100">
              </el-table-column>
              <el-table-column label="最近7天" prop="oneWeekInto" fixed width="100">
              </el-table-column>
              <el-table-column label="最近15天" prop="twoWeekInto" fixed width="100">
              </el-table-column>
              <el-table-column label="最近30天" prop="monthInto" fixed width="100">
              </el-table-column>
              <el-table-column v-for="item in $tools.getMonthData1(this.recruitForm.yearMonthDate)"
                               :label="item.date" :prop="'day'+item.dayIndex">
              </el-table-column>
            </el-table>
            <el-table :data="recruitData2" border stripe sum-text="合计" show-summary
                      :span-method="objectSpanMethod3" :header-cell-style="{'text-align':'center'}"
                      :cell-style="{'text-align':'center'}">
              <el-table-column label="部门" prop="deptLevel1" min-width="120" fixed>
              </el-table-column>
              <el-table-column label="人力性质" prop="natureManPower" fixed width="120"></el-table-column>
              <el-table-column label="离职合计" prop="totalCount" fixed width="100">
              </el-table-column>
              <el-table-column label="最近7天" prop="oneWeekInto" fixed width="100">
              </el-table-column>
              <el-table-column label="最近15天" prop="twoWeekInto" fixed width="100">
              </el-table-column>
              <el-table-column label="最近30天" prop="monthInto" fixed width="100">
              </el-table-column>
              <el-table-column v-for="item in $tools.getMonthData1(this.recruitForm.yearMonthDate)"
                               :label="item.date" :prop="'day'+item.dayIndex">
              </el-table-column>
            </el-table>
            <el-table :data="recruitData3" border stripe sum-text="合计" show-summary :span-method="objectSpanMethod4"
                      :header-cell-style="{'text-align':'center'}" v-show="true"
                      :cell-style="{'text-align':'center'}">
              <el-table-column label="部门" prop="deptLevel1" min-width="120" fixed>
              </el-table-column>
              <el-table-column label="人力性质" prop="natureManPower" fixed width="120"></el-table-column>
              <el-table-column label="净增长合计" prop="totalCount" fixed width="100">
              </el-table-column>
              <el-table-column v-for="item in $tools.getMonthData1(this.recruitForm.yearMonthDate)"
                               :label="item.date" :prop="'day'+item.dayIndex">
              </el-table-column>
            </el-table>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane name="summary1" label="正式/临时工占比">
        <div class="tool">
          <el-form :inline="true">
            <el-form-item label="日期">
              <el-date-picker size="small"
                              v-model="recruitForm1.yearMonthDate"
                              type="date"
                              placeholder="选择月"
                              :clearable="false">
              </el-date-picker>
            </el-form-item>
            <el-form-item>
              <el-button @click="getPeopleNumData" size="small">查询</el-button>
            </el-form-item>
          </el-form>
        </div>
        <el-row :gutter="20">
          <el-col :span="12">
            <el-table :data="peopleNumData1" border stripe sum-text="合计" show-summary
                      :span-method="objectSpanMethod5" :header-cell-style="{'text-align':'center'}"
                      :cell-style="{'text-align':'center'}">
              <el-table-column label="部门" prop="deptLevel" min-width="120" fixed>
              </el-table-column>
              <el-table-column label="人力性质" prop="natureManpower" fixed></el-table-column>
              <el-table-column label="总人力" fixed width="100" prop="totalCount">
                <!--                <template slot-scope="scope">-->
                <!--                  {{ scope.row.self + scope.row.other }}-->
                <!--                </template>-->
              </el-table-column>
              <el-table-column label="正式工" prop="self" fixed width="100">
              </el-table-column>
              <el-table-column label="中介长期工" prop="other" fixed width="100">
              </el-table-column>
              <el-table-column label="临时工占比" fixed width="100">
                <template slot-scope="scope">
                  {{ getNumber(scope.row.other, scope.row.self + scope.row.other) }}
                </template>
              </el-table-column>
            </el-table>
          </el-col>
          <el-col :span="12">

            <el-table :data="peopleNumData2" border stripe sum-text="合计" show-summary
                      :span-method="objectSpanMethod6" :header-cell-style="{'text-align':'center'}"
                      :cell-style="{'text-align':'center'}">
              <el-table-column label="部门" prop="deptLevel1" min-width="120" fixed>
              </el-table-column>
              <el-table-column label="招聘渠道" prop="recruitmentChannels" fixed></el-table-column>
              <el-table-column label="总人力" prop="peopleNum" fixed width="100">
                <template>
                </template>
              </el-table-column>
            </el-table>

          </el-col>
        </el-row>
      </el-tab-pane>
    </el-tabs>

  </div>
</template>

<script>
import a from "@/plugins/a.json"
import moment from "moment";
import {create} from "axios";
import LoginView from "@/views/LoginView";

export default {
  name: "PersonnelReport.vue",
  data() {
    return {
      activeName: "detail",
      activeName1: "system",
      summaryData: [],
      detailData: [],
      recruitData1: [],
      recruitData2: [],
      recruitData3: [],
      peopleNumData1: [],
      peopleNumData2: [],

      form: {
        archivesDate: moment().format("YYYY-MM-DD")

      },
      recruitForm: {
        yearMonthDate: moment().format("YYYY-MM-01")
      },
      recruitForm1: {
        yearMonthDate: moment().format("YYYY-MM-DD")
      },
      rowSpanArr: [],
      rowSpanArr1: [],
      rowSpanArr2: [],
      rowSpanArr3: [],
      rowSpanArr4: [],
      rowSpanArr5: [],
      rowSpanArr6: [],
      shouldArriveList: []
    }
  },
  created() {
    this.getDataMethod()
  },
  computed: {
    title() {
      return moment(this.form.archivesDate).add(-1).format("YYYY-MM-DD") + "夜班和" + moment(this.form.archivesDate).format("YYYY-MM-DD") + "白班"
    }
  },
  methods: {
    getDataMethod() {

      axios.post("/personnel/attendance_detail/getShouldArrive", this.form).then(res => {
        console.log("REsData:", res)
        if (res.data.success) {
          this.shouldArriveList = res.data.data
          if (this.activeName === 'detail') {
            this.getDetailDataList()
          } else if (this.activeName === "summary") {
            this.getSummaryDataList()
            this.getRecruitData()
          } else if (this.activeName === 'summary1') {
            this.getPeopleNumData()
          }
        } else {
          this.shouldArriveList = []
        }
      })


    },
    handleClick(tab, event) {
      console.log(tab, event);
      this.activeName = tab.name
      this.getDataMethod()
    },
// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel2 === tableData[index - 1].deptLevel2) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr = rowSpanArr
    },// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData1(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel2 === tableData[index - 1].deptLevel2) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr1 = rowSpanArr
    },// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData2(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel1 === tableData[index - 1].deptLevel1) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr2 = rowSpanArr
    },// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData3(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel1 === tableData[index - 1].deptLevel1) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr3 = rowSpanArr
    },// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData4(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel1 === tableData[index - 1].deptLevel1) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr4 = rowSpanArr
    },// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData5(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel === tableData[index - 1].deptLevel) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr5 = rowSpanArr
    },// 获取相同名称的个数 tableData: 表格的数据, projectName: 确定相同的参数
    handleTableData6(tableData) {
      let rowSpanArr = [], position = 0;
      for (let [index, item] of tableData.entries()) {
        if (index === 0) {
          rowSpanArr.push(1);
          position = 0;
        } else {
          if (item.deptLevel1 === tableData[index - 1].deptLevel1) {
            rowSpanArr[position] += 1; //项目名称相同，合并到同一个数组中
            rowSpanArr.push(0);
          } else {
            rowSpanArr.push(1);
            position = index;
          }
        }
      }
      this.rowSpanArr6 = rowSpanArr
    },
// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod1({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr1[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod2({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr2[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod3({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr3[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod4({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr4[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod5({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr5[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },// 单元格的处理方法 当前行row、当前列column、当前行号rowIndex、当前列号columnIndex
    objectSpanMethod6({row, column, rowIndex, columnIndex}) {
      if (columnIndex === 0) {
        const rowSpan = this.rowSpanArr6[rowIndex];
        return {
          rowspan: rowSpan, //行
          colspan: 1 //列
        };
      }
    },
    getNumber(x, y) {
      return ((x / y) * 100).toFixed(2) + "%"
    },

    getDetailDataList() {
      axios.post("/personnel/attendance_detail/list/detail2", this.form).then(res => {
        console.log("DetailData:", res)
        if (res.data.success) {
          let data = res.data.data
          console.log("D:{", res.data.data)
          console.log("ShouldArrive:", this.shouldArriveList)
          if (this.shouldArriveList.length > 0) {
            this.shouldArriveList.forEach(item => {
              item.actualArrive = 0;
            })
            this.shouldArriveList.forEach(item => {
              data.forEach(child => {
                if ((child.deptLevel2 === item.deptLevel2) && (child.natureManpower === item.natureManpower) && (child.shift === item.shift)) {
                  console.log("有相同的")
                  item.actualArrive = child.actualArrive
                  item.deptLevel2 = child.deptLevel2
                  item.shift = child.shift
                  item.natureManpower = child.natureManpower
                  item.freeSign = child.freeSign
                  item.unAttendance = (parseInt(item.shouldArrive) - parseInt(child.actualArrive)) || 0
                  item.yearLeave = child.yearLeave
                  item.absenteeism = child.absenteeism
                  item.workInjuryLeave = child.workInjuryLeave
                  item.sickLeave = child.sickLeave
                  item.maternityLeave = child.maternityLeave
                  item.personalLeave = child.personalLeave
                  item.marriageLeave = child.marriageLeave
                  item.funeralLeave = child.funeralLeave
                  item.compensatoryLeave = child.compensatoryLeave
                  item.businessTrips = child.businessTrips
                }
              })
            })


          }

          console.log("D1:{", this.shouldArriveList)
          this.detailData = this.shouldArriveList
          this.detailData.forEach(item => {
            if (item.actualArrive > item.shouldArrive) {
              item.shouldArrive = item.actualArrive
            }
            item.unAttendance = item.shouldArrive - item.actualArrive

            console.log("DeptLEvel:", item)
            if (item.freeSign === undefined) {
              item.freeSign = 0
            }
          })
          console.log("D2:{", this.detailData)
          this.handleTableData(this.detailData)

        } else {
          // this.detailData = []
        }
      })
    },
    getSummaryDataList() {
      axios.post("/personnel/attendance_detail/list/summary", this.form).then(res => {
        console.log("SummaryData:", res)
        if (res.data.success) {
          this.summaryData = res.data.data

          this.handleTableData1(this.summaryData)
        } else {
          this.summaryData = []
        }
      })
    },
    getRecruitData() {
      this.getRecruitDataList1()
      this.getRecruitDataList2()
      this.getRecruitDataList3()
    },
    getRecruitDataList1() {
      axios.post("/personnel/recruit/listByMonth/into", this.recruitForm).then(res => {
        console.log("RecruitData:", res)
        if (res.data.success) {
          this.recruitData1 = res.data.data

          // this.recruitData1.forEach(item=>{
          //   let total=0;
          //   for(var i=1;i<=31;i++){
          //
          //     total+=parseInt(item["day"+i])
          //   }
          //   console.log("total:",total)
          // })
          this.handleTableData2(this.recruitData1)
        } else {
          this.recruitData1 = []
        }
      })
    },
    getRecruitDataList2() {
      axios.post("/personnel/recruit/listByMonth/out", this.recruitForm).then(res => {
        console.log("RecruitData:", res)
        if (res.data.success) {
          this.recruitData2 = res.data.data
          this.handleTableData3(this.recruitData2)

        } else {
          this.recruitData2 = []
        }
      })
    },
    getRecruitDataList3() {
      axios.post("/personnel/recruit/listByMonth/into_and_out", this.recruitForm).then(res => {
        console.log("RecruitData:", res)
        if (res.data.success) {
          this.recruitData3 = res.data.data
          const mergedData = {};
          this.recruitData3.forEach(item => {
            const deptLevel1 = item.deptLevel1;
            if (!mergedData[deptLevel1]) {
              mergedData[deptLevel1] = item;
            } else {
              mergedData[deptLevel1].totalCount += item.totalCount;
              for (let i = 1; i <= this.$tools.getMonthData1(this.recruitForm.yearMonthDate); i++) {
                const dayKey = "day" + i;
                mergedData[deptLevel1][dayKey] += item[dayKey];
              }
            }
          });

          const mergedDataArray = Object.values(mergedData);
          console.log("MergeData:", mergedDataArray)
          this.recruitData3 = mergedDataArray
          this.handleTableData4(this.recruitData3)
        } else {
          this.recruitData3 = []
        }
      })
    },
    getPeopleNumData() {
      this.getPeopleNumByDept()
      this.getPeopleNumByRecruitmentChannels()
    },
    getPeopleNumByRecruitmentChannels() {
      const data = {
        archivesDate: moment(this.recruitForm1.yearMonthDate).format("YYYY-MM-DD")
      }
      axios.post("/personnel/recruit/listByRecruitmentChannels", data).then(res => {
        console.log("Data:", res)

        if (res.data.success) {
          this.peopleNumData2 = res.data.data
          this.handleTableData6(this.peopleNumData2)
        } else {
          this.peopleNumData2 = []
        }
      })
    },
    getPeopleNumByDept() {
      const data = {
        archivesDate: moment(this.recruitForm1.yearMonthDate).format("YYYY-MM-DD")
      }

      axios.post("/personnel/recruit/listByDept", data).then(res => {
        console.log("Data:", res)
        if (res.data.success) {
          this.peopleNumData1 = res.data.data
          this.peopleNumData1.forEach(item => {
            item.totalCount = item.self + item.other
          })
          this.handleTableData5(res.data.data)
        } else {
          this.peopleNumData1 = []
        }
      })
    }

  }
}
</script>

<style lang="less">
.personnel {
  .el-table .el-table__cell {
    padding: 3px 0;
  }
}
</style>
